package top.fullj.fsm;

import com.google.common.base.Preconditions;
import top.fullj.bean.ToString;

/**
 * @author bruce.wu
 * @since 2021/8/2 10:48
 */
public class Transaction {

    final Condition condition;
    final State next;

    public Transaction(State init, Event event, State next) {
        Preconditions.checkNotNull(init);
        Preconditions.checkNotNull(event);
        Preconditions.checkNotNull(next);
        this.condition = new Condition(init, event);
        this.next = next;
    }

    @Override
    public String toString() {
        return ToString.toStringHelper(this)
                .add("condition", condition)
                .add("next", next)
                .toString();
    }

}
